package com.kaishengit.util;

import java.util.TimeZone;
import hirondelle.date4j.DateTime;


public class DateUtil {
	
	public static String getNowTime() {
		DateTime today = DateTime.now(TimeZone.getDefault());
		return today.format("YYYY-MM-DD hh:mm:ss");
	}
	public static int toToday(String time) {
		
		String[] result1 = time.split(" ");
		String[] results = result1[0].split("-");
		String[] result2 = result1[1].split(":");
		DateTime date = new DateTime(Integer.parseInt(results[0]), Integer.parseInt(results[1]),Integer.parseInt(results[2]),
				Integer.parseInt(result2[0]),Integer.parseInt(result2[1]),Integer.parseInt(result2[2]),0);

		int result= 0;
		if (date.isInTheFuture(TimeZone.getDefault())) {
			result = 1;
		} else if (date.isInThePast(TimeZone.getDefault())) {
			result = -1;
		} 
		return result;
	}	
	
	public static void main(String[] args) {
		System.out.println(toToday("2012-8-8 20:0:0"));
		
	}
}
